<template>
    <div>

        <div v-if="page.data.data.length > 0">

            <div class="layui-col-md18 left">
                <div class="article-detail shadow">

                    <div class="article-detail-content w-e-text">
                        <div v-html="news.contents">

                        </div>
                        <lay-backtop target="#app" :showHeight="200" :bottom="100" bgcolor="#5FB878" icon="layui-icon-up"
                            circle></lay-backtop>

                    </div>
                </div>
            </div>

            
            <lay-layer title="目录" move="true" offset="r" :shade="false" :closeBtn="false" :area="['20%', '50%']"
                :shadeClose="false" v-model="visible">
      
                <div class="layui-panel">
                    <ul class="site-dir layui-layer-wrap">
                        <li v-for="(item, index) in page.data.data" :key="index">
                            <a href="javascript:;" @click="editRowEvent(item)">
                                {{ item.title }}</a>
                        </li>
                    </ul>
                </div>
            </lay-layer>




        </div>

        <!-- 使用样式属性自定义 -->
        <!--遮罩-->
        <div class="blog-mask animated layui-hide"></div>
        <!--js-->

    </div>
</template>
    
<script lang="ts" setup>
import { ref, reactive } from "vue";
import { ReleaseIcon } from '@layui/icons-vue';
import { useRoute, useRouter } from "vue-router";
import http from 'webosutils/lib/http';
const news = ref({ title: "", contents: "" });
const visible = ref(true);
const router = useRouter();
const route = useRoute();
const handleBack = () => {
    window.history.back();
}
const loading = ref(false);
const editRowEvent = (row: any) => {

    news.value = row;

}
const waitcolumns = ref([

    {
        title: "",

        key: "title"
    }
]);


const page = ref({
    limit: 100,
    current: 1,
    total: 0, limits: [10, 100, 200],
    search: {
        title: ""
    },
    data: { title: "", data: [] as any }
});
const ajax = () => {
    console.log(route.params.type)
    http.post("/v1/api/portalsite/GetNew", { type: route.params.type, title: page.value.search.title, page: page.value.current, limit: page.value.limit }, "请稍等").then(res => {

        page.value.total = res.count;
        page.value.data.data = res.data;
        if (res.data.length > 0) {
            news.value = res.data[0];
        }
        // pageconfig.value.data.title="免费ppt模板下载";
        var win = window as any;
        win.scrollTo(0, 0)

    }).catch(res => {

    })



}
ajax();
</script>
<style>
.site-dir li {
    line-height: 26px;
    margin-left: 20px;
    overflow: visible;
    list-style-type: disc;
}
</style>